<?php die(1); ?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>layuiAdmin 控制台主页一</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="{$Think.const.admin_tpl}/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="{$Think.const.admin_tpl}/style/admin.css" media="all">
</head>
<body>
<div class="layui-fluid">
  <div class="layui-row layui-col-space15">
    <div class="layui-col-md8">
      <div class="layui-row layui-col-space15">
        <div class="layui-col-md6">
          <div class="layui-card">
            <div class="layui-card-header">快捷方式</div>
            <div class="layui-card-body">

              <div class="layui-carousel layadmin-carousel layadmin-shortcut">
                <div carousel-item>
                  <ul class="layui-row layui-col-space10">
                    <li class="layui-col-xs3">
                      <a lay-href="/admin/clients/index.html">
                        <i class="layui-icon layui-icon-user"></i>
                        <cite>小程序客户</cite>
                      </a>
                    </li>
                    <li class="layui-col-xs3">
                      <a lay-href="/admin/introductions/pub">
                        <i class="layui-icon layui-icon-list"></i>
                        <cite>公共说明书管理</cite>
                      </a>
                    </li>
                    <li class="layui-col-xs3">
                      <a lay-href="/admin/rules/index">
                        <i class="layui-icon layui-icon-auz"></i>
                        <cite>角色权限</cite>
                      </a>
                    </li>
                    <li class="layui-col-xs3">
                      <a lay-href="/admin/users/index">
                        <i class="layui-icon layui-icon-username"></i>
                        <cite>用户管理</cite>
                      </a>
                    </li>
                  </ul>
                  <!--
                <ul class="layui-row layui-col-space10">
                  <li class="layui-col-xs3">
                    <a lay-href="set/user/info.html">
                      <i class="layui-icon layui-icon-set"></i>
                      <cite>设置</cite>
                    </a>
                  </li>
                </ul>
                -->
                </div>
              </div>

            </div>
          </div>
        </div>
        <div class="layui-col-md6">
          <div class="layui-card">
            <div class="layui-card-header">最新</div>
            <div class="layui-card-body">

              <div class="layui-carousel layadmin-carousel layadmin-backlog">
                <div carousel-item>
                  <ul class="layui-row layui-col-space10" id="counter-id">
                  </ul>
                  <!--
                <ul class="layui-row layui-col-space10">
                  <li class="layui-col-xs6">
                    <a href="javascript:;" class="layadmin-backlog-body">
                      <h3>待审友情链接</h3>
                      <p><cite style="color: #FF5722;">5</cite></p>
                    </a>
                  </li>
                </ul>
                -->
                </div>
              </div>
            </div>
          </div>
        </div>
        <div class="layui-col-md12">
          <div class="layui-card">
            <div class="layui-card-header">数据概览</div>
            <div class="layui-card-body">

              <div class="layui-carousel layadmin-carousel layadmin-dataview" data-anim="fade"
                   lay-filter="LAY-index-dataview">
                <div carousel-item id="LAY-index-dataview">
                  <div><i class="layui-icon layui-icon-loading1 layadmin-loading"></i></div>
                  <div></div>
                  <!--<div></div>-->
                </div>
              </div>

            </div>
          </div>
          <!--
          <div class="layui-card">
            <div class="layui-tab layui-tab-brief layadmin-latestData">
              <ul class="layui-tab-title">
                <li class="layui-this">今日热搜</li>
                <li>今日热帖</li>
              </ul>
              <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                  <table id="LAY-index-topSearch"></table>
                </div>
                <div class="layui-tab-item">
                  <table id="LAY-index-topCard"></table>
                </div>
              </div>
            </div>
          </div>
          -->
        </div>
      </div>
    </div>

    <div class="layui-col-md4">
      <div class="layui-card">
        <div class="layui-card-header">版本信息</div>
        <div class="layui-card-body layui-text">
          <table class="layui-table">
            <colgroup>
              <col width="100">
              &nbsp;
              <col>
            </colgroup>
            <tbody>
            <tr>
              <td>当前版本</td>
              <td>1.0.0beta</td>
            </tr>
            <tr>
              <td>开发语言</td>
              <td>
                PHP {:phpversion()}
              </td>
            </tr>
            <tr>
              <td>数据库</td>
              <td>
                MYSQL {:mysqli_get_client_version()}
              </td>
            </tr>
            <tr>
              <td>服务器</td>
              <td>
                {$Think.SERVER.OS} {$Think.SERVER.SERVER_SOFTWARE}
              </td>
            </tr>
            </tbody>
          </table>
        </div>
      </div>
      <!--
            <div class="layui-card">
              <div class="layui-card-header">效果报告</div>
              <div class="layui-card-body layadmin-takerates">
                <div class="layui-progress" lay-showPercent="yes">
                  <h3>转化率（日同比 28% <span class="layui-edge layui-edge-top" lay-tips="增长" lay-offset="-15"></span>）
                  </h3>
                  <div class="layui-progress-bar" lay-percent="65%"></div>
                </div>
                <div class="layui-progress" lay-showPercent="yes">
                  <h3>签到率（日同比 11% <span class="layui-edge layui-edge-bottom" lay-tips="下降"
                                        lay-offset="-15"></span>）</h3>
                  <div class="layui-progress-bar" lay-percent="32%"></div>
                </div>
              </div>
            </div>
      -->
      <div class="layui-card">
        <div class="layui-card-header">售后完成率</div>
        <div class="layui-card-body layadmin-takerates">
          <div class="layui-progress" lay-showPercent="<?=$ratio['all_count']?:'';?>">
            <h3>维修完成率</h3>
            <div class="layui-progress-bar" lay-show lay-percent="{$ratio.finish}%"></div>
          </div>
          <div class="layui-progress" lay-showPercent="<?=$ratio['all_count']?:'';?>">
            <h3>指派完成率</h3>
            <div class="layui-progress-bar" lay-percent="{$ratio.assigned}%"></div>
          </div>
        </div>
      </div>
      <!--
        <DIV CLASS="LAYUI-CARD">
          <DIV CLASS="LAYUI-CARD-HEADER">产品动态</DIV>
          <DIV CLASS="LAYUI-CARD-BODY">
            <DIV CLASS="LAYUI-CAROUSEL LAYADMIN-CAROUSEL LAYADMIN-NEWS" DATA-AUTOPLAY="TRUE" DATA-ANIM="FADE" LAY-FILTER="NEWS">
              <DIV CAROUSEL-ITEM>
                <DIV><A HREF="HTTP://FLY.LAYUI.COM/DOCS/2/" TARGET="_BLANK" CLASS="LAYUI-BG-RED">LAYUIaDMIN 快速上手文档</A></DIV>
                <DIV><A HREF="JAVASCRIPT:;" ONCLICK="LAYER.MSG('等待添加')" TARGET="_BLANK" CLASS="LAYUI-BG-GREEN">LAYUIaDMIN 集成心得分享</A></DIV>
                <DIV><A HREF="JAVASCRIPT:;" ONCLICK="LAYER.MSG('等待添加')" TARGET="_BLANK" CLASS="LAYUI-BG-BLUE">首款 LAYUI 官方后台模板系统正式发布</A></DIV>
              </DIV>
            </DIV>
          </DIV>
        </DIV>
        <DIV CLASS="LAYUI-CARD">
          <DIV CLASS="LAYUI-CARD-HEADER">
            作者心语
            <I CLASS="LAYUI-ICON LAYUI-ICON-TIPS" LAY-TIPS="要支持的噢" LAY-OFFSET="5"></I>
          </DIV>
          <DIV CLASS="LAYUI-CARD-BODY LAYUI-TEXT LAYADMIN-TEXT">
            <P>一直以来，LAYUI 秉承无偿开源的初心，虔诚致力于服务各层次前后端 wEB 开发者，在商业横飞的当今时代，这一信念从未动摇。即便身单力薄，仍然重拾决心，埋头造轮，以尽可能地填补产品本身的缺口。</P>
            <P>在过去的一段的时间，我一直在寻求持久之道，已维持你眼前所见的一切。而 LAYUIaDMIN 是我们尝试解决的手段之一。我相信真正有爱于 LAYUI 生态的你，定然不会错过这一拥抱吧。</P>
            <P>子曰：君子不用防，小人防不住。请务必通过官网正规渠道，获得 <A HREF="HTTP://WWW.LAYUI.COM/ADMIN/" TARGET="_BLANK">LAYUIaDMIN</A>！</P>
            <P>—— 贤心（<A HREF="HTTP://WWW.LAYUI.COM/" TARGET="_BLANK">LAYUI.COM</A>）</P>
          </DIV>
        </DIV>
      -->
    </div>
  </div>
</div>

<script src="{$Think.const.admin_tpl}/layui/layui.js?t=1"></script>
<script>


  layui.config({
    base: '{$Think.const.admin_tpl}/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'console'], function () {

    //echart
    layui.use(['carousel', 'echarts'], function () {
      var $ = layui.$
        , carousel = layui.carousel
        , echarts = layui.echarts;

      var echartsApp = [], options = [

          //新增的用户量
          {
            title: {
              text: '一周新增的客户端',
              x: 'center',
              textStyle: {
                fontSize: 14
              }
            },
            tooltip: { //提示框
              trigger: 'axis',
              formatter: "{b}<br>新增客户端：{c}"
            },
            xAxis: [{ //X轴
              type: 'category',
              data: JSON.parse('<?=$date_str?>')
          }],
        yAxis: [{  //Y轴
          type: 'value'
        }],
        series: [{ //内容
          type: 'line',
          data: JSON.parse('<?=$num_str?>')
        }]
    },

        //访客浏览器分布
        {
          title: {
            text: '售后状态比例',
            x: 'center',
            textStyle: {
              fontSize: 14
            }
          },
          tooltip: {
            trigger: 'item',
            formatter: "{a} <br/>{b} : {c} ({d}%)"
          },
          legend: {
            orient: 'vertical',
            x: 'left',
            data: JSON.parse('<?=$statuss_str?>')
          },
          series: [{
            name: '数据统计',
            type: 'pie',
            radius: '55%',
            center: ['50%', '50%'],
            data: JSON.parse('<?=$data_str?>')
          }]
        },

      //今日流量趋势
      /*
      {
        title: {
          text: '今日流量趋势',
            x: 'center',
            textStyle: {
            fontSize: 14
          }
        },
        tooltip: {
          trigger: 'axis'
        },
        legend: {
          data: ['', '']
        },
        xAxis: [{
          type: 'category',
          boundaryGap: false,
          data: ['06:00', '06:30', '07:00', '07:30', '08:00', '08:30', '09:00', '09:30', '10:00', '11:30', '12:00', '12:30', '13:00', '13:30', '14:00', '14:30', '15:00', '15:30', '16:00', '16:30', '17:00', '17:30', '18:00', '18:30', '19:00', '19:30', '20:00', '20:30', '21:00', '21:30', '22:00', '22:30', '23:00', '23:30']
        }],
          yAxis: [{
        type: 'value'
      }],
        series: [{
        name: 'PV',
        type: 'line',
        smooth: true,
        itemStyle: {normal: {areaStyle: {type: 'default'}}},
        data: [111, 222, 333, 444, 555, 666, 3333, 33333, 55555, 66666, 33333, 3333, 6666, 11888, 26666, 38888, 56666, 42222, 39999, 28888, 17777, 9666, 6555, 5555, 3333, 2222, 3111, 6999, 5888, 2777, 1666, 999, 888, 777]
      }, {
        name: 'UV',
        type: 'line',
        smooth: true,
        itemStyle: {normal: {areaStyle: {type: 'default'}}},
        data: [11, 22, 33, 44, 55, 66, 333, 3333, 5555, 12666, 3333, 333, 666, 1188, 2666, 3888, 6666, 4222, 3999, 2888, 1777, 966, 655, 555, 333, 222, 311, 699, 588, 277, 166, 99, 88, 77]
      }]
      },
*/

      ]
        , elemDataView = $('#LAY-index-dataview').children('div')
        , renderDataView = function (index) {
        echartsApp[index] = echarts.init(elemDataView[index], layui.echartsTheme);
        echartsApp[index].setOption(options[index]);
        window.onresize = echartsApp[index].resize;
      };


      //没找到DOM，终止执行
      if (!elemDataView[0]) return;


      renderDataView(0);

      //监听数据概览轮播
      var carouselIndex = 0;
      carousel.on('change(LAY-index-dataview)', function (obj) {
        renderDataView(carouselIndex = obj.index);
      });

      //监听侧边伸缩
      layui.admin.on('side', function () {
        setTimeout(function () {
          renderDataView(carouselIndex);
        }, 300);
      });

      //监听路由
      layui.admin.on('hash(tab)', function () {
        layui.router().path.join('') || renderDataView(carouselIndex);
      });
    });

    //总计
    layui.use([], function () {
      function renderCounter(obj) {
        console.log(obj);
        if (obj instanceof Object) {
          var $ = layui.$, str = '';
          $.ajax({
            url: obj.url,
            type: 'get',
            dataType: 'json',
            success: function (data) {
              str = '<a href="' + obj.locate + '" class="layadmin-backlog-body"> \
                <h3>' + obj.name + '</h3> \
                <p><cite>' + data.data + '</cite></p> \
              </a>';
              $('#' + obj.id).html(str);
            }
          });
        }
      }
      var $ = layui.$, strs = '', counters = [
        {
          url: '/admin/maintains/order_new',
          locate: '/admin/maintains/confirm/',
          name: '待指派',
          id: 'counter-check',
        },
        {
          url: '/admin/clients/client_new',
          locate: '/admin/clients/index/',
          name: '今天新注册客户',
          id: 'counter-client',
        },
        {
          url: '/admin/introductions/intro_new',
          // locate: 'javascript:;',
          locate: '/admin/introductions/pub/',
          name: '今天新增说明书',
          id: 'counter-intro',
        },
      ];
      for (var i in counters) {
        strs +=
          '<li class="layui-col-xs6" id="' + counters[i].id + '">\
            <a href="javascript:;" class="layadmin-backlog-body">\
            <h3>' + counters[i].name + '</h3>\
            <p><cite>0</cite></p>\
          </a>\
          </li>';
      }
      $('#counter-id').append(strs);
      counters.map(function (v) {
        renderCounter(v);
      });
    });

    //进度
    layui.use([], function () {
      var $ = layui.$;

    });


  });


</script>
</body>
</html>

